package cn.cailin.day07.demo02Recursion;

import java.io.File;

public class test {
    public static void main(String[] args) {
        File f=new File("d:\\IDEA");
        getAllFile(f);
    }

    private static void getAllFile(File dir) {
        File[] files = dir.listFiles(pathname ->pathname.isDirectory()||pathname.getName().toLowerCase().endsWith(".java"));
        for (File f : files) {
            if (f.isDirectory()) {//判断是否为目录
                getAllFile(f);
            }else if (f.getName().toLowerCase().endsWith(".java")){
                System.out.println(f);
            }
        }

        

    }
}
